package com.service.imp;

import com.dao.CheckerDao;
import com.pojo.Bill;
import com.pojo.Goods;
import com.service.CheckerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CheckerServiceImp implements CheckerService {
    @Autowired
    private CheckerDao checkerDao;
    public List<Goods> getGoods() {
        return checkerDao.getGoods();
    }

    public int insertBill(Bill bill) {
        return checkerDao.insertBill(bill);
    }

    public int updateGoodsCount(Bill bill) {
        return checkerDao.updateGoodsCount(bill);
    }

    public List<Bill> shoppingCart(int userid) {
        return checkerDao.shoppingCart(userid);
    }

    public int deleteShopping(int id) {
        return checkerDao.deleteShopping(id);
    }

    public int updateBill(int id) {
        int i =  checkerDao.updateBill(id);
        if (i>0){
            return checkerDao.updateGoodsBybid(id);
        }
        return -1;
    }
}
